home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Source Code / C / Libraries / GUSI 1.4.1 / GUSI / include / compat.h next >
Encoding:
C/C++ Source or Header  |  1994-02-25  |  3.8 KB  |  111 lines  |  [TEXT/MPS ]

  1. /*-
  2.  * Copyright (c) 1991, 1993
  3.  *    The Regents of the University of California.  All rights reserved.
  4.  *
  5.  * Redistribution and use in source and binary forms, with or without
  6.  * modification, are permitted provided that the following conditions
  7.  * are met:
  8.  * 1. Redistributions of source code must retain the above copyright
  9.  *    notice, this list of conditions and the following disclaimer.
  10.  * 2. Redistributions in binary form must reproduce the above copyright
  11.  *    notice, this list of conditions and the following disclaimer in the
  12.  *    documentation and/or other materials provided with the distribution.
  13.  * 3. All advertising materials mentioning features or use of this software
  14.  *    must display the following acknowledgement:
  15.  *    This product includes software developed by the University of
  16.  *    California, Berkeley and its contributors.
  17.  * 4. Neither the name of the University nor the names of its contributors
  18.  *    may be used to endorse or promote products derived from this software
  19.  *    without specific prior written permission.
  20.  *
  21.  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  22.  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  23.  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  24.  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  25.  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  26.  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  27.  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  28.  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  29.  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  30.  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  31.  * SUCH DAMAGE.
  32.  *
  33.  *    @(#)compat.h    8.1 (Berkeley) 6/2/93
  34.  */
  35.  
  36. #ifndef    _COMPAT_H_
  37. #define    _COMPAT_H_
  38.  
  39. /*
  40.  * If your system doesn't specify a max size for a SIZE_T, check
  41.  * to make sure this is the right one.
  42.  */
  43. #ifndef SIZE_T_MAX
  44. #define    SIZE_T_MAX    UINT_MAX
  45. #endif
  46.  
  47. /*
  48.  * If you don't have POSIX 1003.1 signals, the signal code surrounding the 
  49.  * temporary file creation is intended to block all of the possible signals
  50.  * long enough to create the file and unlink it.  All of this stuff is
  51.  * intended to use old-style BSD calls to fake POSIX 1003.1 calls.
  52.  */
  53. #ifdef NO_POSIX_SIGNALS
  54. #define sigemptyset(set)    (*(set) = 0)
  55. #define sigfillset(set)        (*(set) = ~(sigset_t)0, 0)
  56. #define sigaddset(set,signo)    (*(set) |= sigmask(signo), 0)
  57. #define sigdelset(set,signo)    (*(set) &= ~sigmask(signo), 0)
  58. #define sigismember(set,signo)    ((*(set) & sigmask(signo)) != 0)
  59.  
  60. #define SIG_BLOCK    1
  61. #define SIG_UNBLOCK    2
  62. #define SIG_SETMASK    3
  63.  
  64. static int __sigtemp;        /* For the use of sigprocmask */
  65.  
  66. #define sigprocmask(how,set,oset) \
  67.     ((__sigtemp = (((how) == SIG_BLOCK) ? \
  68.     sigblock(0) | *(set) : (((how) == SIG_UNBLOCK) ? \
  69.     sigblock(0) & ~(*(set)) : ((how) == SIG_SETMASK ? \
  70.     *(set) : sigblock(0))))), ((oset) ? \
  71.     (*(oset) = sigsetmask(__sigtemp)) : sigsetmask(__sigtemp)), 0)
  72. #endif
  73.  
  74. #if defined(SYSV) || defined(SYSTEM5) || defined(macintosh)
  75. #define    index(a, b)            strchr(a, b)
  76. #define    rindex(a, b)        strrchr(a, b)
  77. #define    bzero(a, b)            memset(a, 0, b)
  78. #define    bcmp(a, b, n)        memcmp(a, b, n)
  79. #define    bcopy(a, b, n)        memmove(b, a, n)
  80. #endif
  81.  
  82. /* POSIX 1003.2 RE limit. */
  83. #ifndef    _POSIX2_RE_DUP_MAX
  84. #define    _POSIX2_RE_DUP_MAX    255
  85. #endif
  86.  
  87. #ifndef    WCOREDUMP            /* 4.4BSD extension */
  88. #define    WCOREDUMP(a)    0
  89. #endif
  90.  
  91. #ifndef _POSIX2_RE_DUP_MAX
  92. #define    _POSIX2_RE_DUP_MAX    255
  93. #endif
  94.  
  95. #ifndef NULL                /* ANSI C #defines NULL everywhere. */
  96. #define    NULL        0
  97. #endif
  98.  
  99. #ifndef    MAX
  100. #define    MAX(_a,_b)    ((_a)<(_b)?(_b):(_a))
  101. #endif
  102. #ifndef    MIN
  103. #define    MIN(_a,_b)    ((_a)<(_b)?(_a):(_b))
  104. #endif
  105.  
  106. #ifndef _BSD_VA_LIST_
  107. #define    _BSD_VA_LIST_    char *
  108. #endif
  109.  
  110. #endif /* !_COMPAT_H_ */
  111.